# _*_ coding: utf-8 _*_
import scrapy
from sspai.items import SspaiItem


class SspaituijianSpider(scrapy.Spider):
    name = 'sspaituijian'
    allowed_domains = ['sspai.com']
    start_urls = ['http://sspai.com/']

    def parse(self, response):
        for each in response.xpath('//*[@id="app"]/div[1]/div[3]/div[1]/div[2]/div[1]/div'):
            item = SspaiItem()
            title = each.xpath("div/div/div/div[2]/div[1]/a/div/text()").get()
            author = each.xpath("div/div/div/div[1]/div/div[1]/div/a[2]/span/span/text()").get()

            if title and author is not None:
                item['title'] = title.strip()
                item['author'] = author.strip()

                yield item
        

        #//*[@id="app"]/div[1]/div[3]/div[1]/div[2]/div[1]/div[1]/div/div/div/div[2]/div[1]/a/div

